package top.jacktgq.imooc.candychat;
/**
 * 
 * @Title: MsgActionEnum.java 
 * @Package top.jacktgq.imooc.candychat 
 * @Description: 发送消息的动作枚举
 * @author CandyWall   
 * @date 2021年2月22日 下午8:38:12 
 * @version V1.0
 */
public enum MsgActionEnum {
    CONNECT(1, "第一次（或重连）初始化连接"),
    CHAT(2, "聊天消息"),
    SIGNED(3, "消息签收"),
    KEEPALIVED(4, "客户端保持心跳");
    
    public final Integer type;
    public final String content;
    
    MsgActionEnum(Integer type, String content) {
        this.type = type;
        this.content = content;
    }
    
    public String getActionContentByType(int type) {
        for(MsgActionEnum msgActionEnum : MsgActionEnum.values()) {
            if(msgActionEnum.type == type) {
                return msgActionEnum.content;
            }
        }
        return "";
    }
}
